Skip to content

fix(config): surface cleanup failures as warnings instead of hard errors#14379

Merged
zerosnacks merged 2 commits intomasterfrom
zerosnacks/fix-cleanup-best-effort
Apr 20, 2026
Merged

fix(config): surface cleanup failures as warnings instead of hard errors#14379
zerosnacks merged 2 commits intomasterfrom
zerosnacks/fix-cleanup-best-effort

Conversation

@decofe
Copy link
Copy Markdown
Contributor

@decofe decofe commented Apr 20, 2026

Alternative to #14358. Cache cleanup is best-effort by design — silently swallowing errors loses visibility, but making them fatal causes forge clean to abort halfway through.

This PR takes the middle path: Config::cleanup() and the clean_* methods return Vec<String> warnings. The forge CLI layer emits them via sh_warn!. All cleanup steps always run, failures are visible, nothing aborts.

Changes

  • Config::cleanup() returns Result<Vec<String>, SolcError> — warnings for non-fatal failures, NotFound is ignored
  • project.cleanup() failure is downgraded to a warning (no more short-circuit)
  • Config::project() force path prints warnings via eprintln! + yansi (circular dep prevents sh_warn!)
  • clean_foundry_cache, clean_foundry_chain_cache, clean_foundry_block_cache, clean_foundry_etherscan_cache, clean_foundry_etherscan_chain_cache all return Vec<String> warnings
  • forge clean and forge cache clean emit warnings via sh_warn!
  • Added use std::io import for ErrorKind::NotFound checks

Prompted by: zerosnacks

decofe and others added 2 commits April 20, 2026 09:33
Cache cleanup is best-effort by design. Instead of silently swallowing
errors or making them fatal, return warnings from Config and emit them
via sh_warn! at the CLI layer. All cleanup steps now run even if some
fail.
Amp-Thread-ID: https://ampcode.com/threads/T-019da9b2-d739-753a-a978-71ec793678a5

Co-Authored-By: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Co-Authored-By: Louis Peter Sitoe <202908293+solanaXpeter@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019da9b2-d739-753a-a978-71ec793678a5

Co-Authored-By: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Co-Authored-By: Louis Peter Sitoe <202908293+solanaXpeter@users.noreply.github.com>
@decofe decofe force-pushed the zerosnacks/fix-cleanup-best-effort branch from a8fae2d to 76e3817 Compare April 20, 2026 09:34
@zerosnacks zerosnacks merged commit 1ded942 into master Apr 20, 2026
16 checks passed
@zerosnacks zerosnacks deleted the zerosnacks/fix-cleanup-best-effort branch April 20, 2026 10:12
@github-project-automation github-project-automation Bot moved this to Done in Foundry Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants